import axios from "@/utils/http";

//数据
const state = {
  tableData: [],
  tableTotal: 1,
};

const getters = {
  getSupplierData(state: any) {
    return state.tableData;
  },
  getFilterData(state: any) {
    return state.tableData;
  },
};

const actions = {};

const mutations = {
  setSupplierData(state: any, page: any) {
    console.log("page", page);

    axios({
      url: "/medicine/supplier/findSupList",
      method: "get",
      params: {
        currentPage: page.currentPage,
        pageSize: page.pageSize,
        condition:page.search,
      },
    })
      .then((res: any) => {
        console.log("字典数据", res.data);
        state.tableData = res.data.data;
        state.tableTotal = res.data.count;
      })
      .catch((err) => {
        console.log(err);
      });
  },
};

export default {
  state,
  mutations,
  actions,
  getters,
};
